package svc

import (
	"fmt"
	"xorm.io/xorm"
)

//描述
type Desc struct {
	Value string `json:"value"`
}

type Svc struct {
	*xorm.Engine
}

func NewSvc(engine *xorm.Engine) *Svc {

	return &Svc{
		engine,
	}
}

//反馈结果
func (s *Svc) Descs(phone []string, sex string) []*Desc {

	result := make([]*Desc, 0)
	//门
	var men = phone[8]
	//宫
	var gong = phone[5]
	//神
	var shen = phone[6]
	//星
	var xing = phone[7]
	//天干（上干）
	var tgan = phone[9]

	fmt.Println("宫:", gong,"神:",shen ,"星：", xing, "门:", men, "天干：", tgan,"sex:",sex)

	//条件一(宫和门的关系5，门生宫，门克宫，门宫相同，宫克门，宫生门)
	result_one := s.men_gong(gong, men, sex)
	result = append(result, result_one...)
	////条件二(门和神的关系)
	result_two := s.men_shen(men, shen, sex)
	result = append(result, result_two...)
	////条件三(门与星的关系,星生门，星克门，门生星，门克星)
	result_three := s.men_xing(xing, men, sex)
	result = append(result, result_three...)
	////条件四(门与天干的关系,门克天干，门生天干，天干生门，天干克门)
	result_four := s.men_tgan(men, tgan, sex)
	result = append(result, result_four...)
	//对切片去重
	return result
}
